﻿using Microsoft.Extensions.Configuration;
using System;
using System.Configuration;
using System.Linq;


namespace Org.LyrcsoftFramework.Cloud.Feign
{
    /// <summary>
    /// feign配置类
    /// </summary>
    public class FeignOption
    {
        /// <summary>
        /// global interceptor;全局拦截器
        /// </summary>
        public Type GlobalInterceptorType { get; private set; }
        /// <summary>
        /// set global interceptor;设置全局拦截器
        /// </summary>
        public void SetGlobalInterceptor(Type interceptorType)
        {
            if (!interceptorType.GetInterfaces().Any(it => typeof(IRequestInterceptor) == it))
            {
                throw new Exception($"global interceptor must inherit from interface IRequestInterceptor");
            }

            this.GlobalInterceptorType = interceptorType;
        }
        /// <summary>
        /// 是否开启nacos微服务模式
        /// </summary>
        public bool EnableNacos { get; private set; }

        public void SetEnableNacos()
        {
            this.EnableNacos = true;
        }

    }
}